package com.sparsearr.datastructures.itheima.jiami;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * @Author: ZhaoTR
 * @Date: Created in 2025/4/19 17:16
 * @Description: 添加数组
 * @Version: 1.0
 */

public class AddArr {
    private static final Logger logger = LogManager.getLogger(AddArr.class);

    public static void main(String[] args) {
        int number = 12345;
        int temp = number;
        int count = 0;
        while (number != 0) {
            number = number / 10;
            count++;
        }

        int[] arr = new int[count];
//        int index = 0;
        int index = arr.length - 1;
        while (temp != 0) {
            int ge = temp % 10;
            temp = temp / 10;
            arr[index] = ge;
//            index++;
            index--;
        }

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
